var mongoose = require('mongoose')
var userInfo = require('./models/userInfo')

//39.101.197.215云服务器
//localhost
mongoose.connect('mongodb://39.101.197.215/bookKeeping',{ useNewUrlParser: true.valueOf,useUnifiedTopology: true },(err,cilent)=>{
        if(err){
            console.log(err)
        }else{
            console.log('数据库连接成功')
        }
    })

var monModel = mongoose.Schema

var User = new monModel(userInfo.User)
var TAccount = new monModel(userInfo.OprateLog)
var Room = new monModel(userInfo.Room)

var userModel = mongoose.model('User',User)
var tAccountModel = mongoose.model('TAccount',TAccount)
var roomModel = mongoose.model('Room',Room)

module.exports = {
    userModel,tAccountModel,roomModel
}
